{% extends 'encyclopedia/base.html' %}

{% block title %}配件分类列表 - 相机百科{% endblock %}

{% block content %}
<div class="container mt-4">
    <h2 class="text-center mb-6">相机配件分类</h2>
    
    <div class="row">
        {% if categories %}
            {% for category in categories %}
            <div class="col-md-4 mb-4">
                <div class="card h-100">
                    <div class="card-body">
                        <h5 class="card-title">{{ category.name }}</h5>
                        {% if category.description %}
                        <p class="card-text">{{ category.description }}</p>
                        {% endif %}
                        <p class="card-text text-muted">配件数量：{{ category.accessories.count }}</p>
                        <a href="{% url 'encyclopedia:accessory_category_detail' category.pk %}" class="btn btn-primary">查看配件</a>
                    </div>
                </div>
            </div>
            {% endfor %}
        {% else %}
        <div class="col-12">
            <div class="alert alert-info text-center" role="alert">
                暂无配件分类数据
            </div>
        </div>
        {% endif %}
    </div>
    
    <div class="mt-4 text-center">
        <a href="{% url 'encyclopedia:accessory_list' %}" class="btn btn-secondary">返回配件列表</a>
    </div>
</div>
{% endblock %}